/* Copyright (c) 2010 OFXKit
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#import <Foundation/Foundation.h>

#import "OFXSignOn.h"
#import "OFXObject.h"

@interface OFXDocument : OFXObject {
  NSString* headerVersion;
  NSString* ofxVersion;
  NSString* security;
  NSString* encoding;
  NSString* charset;
  NSString* compression;
  NSString* fileUIDOld;
  NSString* fileUIDNew;
  NSString* language;
  NSDate* clientDate;
  NSDate* serverDate;
}

/**
 * @property headerVersion
 * @brief Specifies the version number of the OFX header used.
 *
 * OFXHEADER specifies the version number of the Open Financial Exchange 
 * declaration.
 * 
 * The OFXHEADER value changes its major number only if an existing client is 
 * unable to process the new header. This can occur because of a complete 
 * syntax change in a header, or a significant change in the semantics of an 
 * existing header element.
 *
 * Because OFX 2.1.1 uses an XML compliant header which significantly differs 
 * from the 1.x header, the value of OFXHEADER is now 2.0 (OFXHEADER="200").
 */
@property(retain) NSString* headerVersion;

/**
 * @property ofxVersion
 * @brief Specifies the version of OFX implemented in document.
 */
@property(retain) NSString* ofxVersion;

/**
 * @property security
 * @brief Specifies the type of application-level security, if any, that is 
 * used for the <OFX> block. The values for SECURITY can be NONE or TYPE1.
 *
 * For a detailed discussion of the types of security supported by OFX see
 * the OFX 2.1 specification chapter 4 on page 93.
 */
@property(retain) NSString* security;

/**
 * @property encoding
 * @brief Specifies encoding of original OFX document.  Fully XML compliant
 * servers will support the full range of XML supported encodings; however,
 * OFX only requires USASCII and UTF-8.
 */
@property(retain) NSString* encoding;

/**
 * @property charset
 * @brief Specifies characterset of original OFX document.
 */
@property(retain) NSString* charset;

/**
 * @property compression
 * @brief Specifies compression of original OFX document.
 */
@property(retain) NSString* compression;

/**
 * @property fileUIDOld
 * @brief identifies the last request and response that was received and 
 * processed by the client.
 */
@property(retain) NSString* fileUIDOld;

/**
 * @property fileUIDNew
 * @brief uniquely identifies this request file. 
 * 
 * The NEWFILEUID, which clients must send with every request file and which 
 * servers must echo in the response, serves two purposes:
 *
 * Servers can use the NEWFILEUID to quickly identify duplicate request files.
 * Clients and servers can use NEWFILEUID in conjunction with OLDFILEUID for 
 * file-based error recovery. For more information about using file-based error 
 * recovery or lite synchronization, see Chapter 6 of the OFX Specification, 
 * "Data Synchronization."
 */
@property(retain) NSString* fileUIDNew;

/**
 * @property language
 * @brief Requested language for text responses
 *
 * Most of the content in OFX is language-neutral. However, some error 
 * messages, balance descriptions, and similar elements contain text meant to 
 * appear to the financial institution customers. There are also cases, such 
 * as e-mail records, where customers need to send text in other languages. To 
 * support worldwide languages, OFX relies on standard XML mechanisms to encode
 * text.
 *
 * The encoding declaration of the standard XML declaration specifies the 
 * character set being used. Servers should respond to clients using the same 
 * encoding as was sent in the client’s request.
 *
 * Clients identify the language in the signon request. OFX specifies languages
 * by three-letter codes as definedinISO-639.  Servers report their supported
 * languages in the profile (see Chapter 7 of OFX 2.1 spec, "FIProfile").
 * If a server cannot support the language requested by the client, it must 
 * return an error and not process the rest of the transactions.
 */
@property(retain) NSString* language;

/**
 * @property clientDate
 * @brief Date and time of the request from the client computer
 *
 * This value should reflect the time (according to the client machine) when 
 * the request file is sent to the server, not the (original) creation time of 
 * the request file. While not required for existing software, OFX 2.1.1 
 * clients must comply with this rule. This clarification is particularly 
 * important in error recovery situations in which the request file may be sent
 * to the server after its initial creation.
 */
@property(retain) NSDate* clientDate;

/**
 * @property serverDate
 * @brief Date and time of the server response
 * 
 * This value should reflect the time (according to the server) when the 
 * response file was originally created. While not required for existing 
 * software, OFX 2.1.1 servers must comply with this rule. This clarification 
 * is particularly important in error recovery situations: The server should 
 * (must for OFX 2.1.1 servers) return the time the request was first 
 * processed. If the previous attempt failed after transactions were processed,
 * <DTSERVER> in the response file would reflect that processing time.
 */
@property(retain) NSDate* serverDate;

@end
